//
//  CustomCollectionViewCell.m
//  HappyBug
//
//  Created by liulei on 2018/10/18.
//  Copyright © 2018年 www.hc.com.cn. All rights reserved.
//

#import "CustomCollectionViewCell.h"

@implementation CustomCollectionViewCell

//init  cell 自定义不会执行
-(instancetype)initWithFrame:(CGRect)frame{
    self=[super initWithFrame:frame];
    if(self){
        [self initView];
    }
    
    return  self;
}

-(void)initView{
    self.topImage = [[UIImageView alloc] initWithFrame:CGRectMake(7, 0, 40, 40)];
    //自适应
    self.topImage.layer.masksToBounds = YES;
    self.topImage.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.topImage];
    
    
    self.btmlabel = [[UILabel alloc] init];
    self.btmlabel.text=@"默认文字";
    self.btmlabel.numberOfLines = 0;
    self.btmlabel.lineBreakMode = NSLineBreakByWordWrapping;
    CGSize size = [self.btmlabel sizeThatFits:CGSizeMake(50, MAXFLOAT)];
    self.btmlabel.textAlignment = NSTextAlignmentCenter;
    self.btmlabel.textColor = [UIColor blackColor];
    self.btmlabel.font = [UIFont fontWithName:@"Arial" size:12.0]; //非加粗
    CGFloat nameW = size.width;
    self.btmlabel.frame = CGRectMake(0, self.topImage.frame.size.height+2, nameW, size.height);
    [self.contentView addSubview:self.btmlabel];
    
    
}

@end
